package com.xiaoq.shop.entity;

import com.xiaoq.MongoEntity;
import io.swagger.annotations.ApiModelProperty;
import org.hibernate.validator.constraints.NotEmpty;
import org.mongodb.morphia.annotations.*;
import org.mongodb.morphia.utils.IndexType;

import javax.validation.constraints.NotNull;

/**
 * @author qudongxin520 created on 2016/8/4.
 * @author xinpeng
 */
@Entity(value = "booking_collection",noClassnameStored = true)
@Indexes({  @Index(options = @IndexOptions(dropDups = true,background = true,unique = true,name = "bookings_collection_index_bookingPhone"),fields = {@Field(value = "bookingPhone",type = IndexType.DESC )})
        //多个索引 @Index
})
public class BookingEntity extends MongoEntity {
    private String shopId;
    @ApiModelProperty(value ="预约时间 格式为：2016-08-22 11:26:51",dataType = "java.lang.String",required = true)
    private Long time;
    @ApiModelProperty(value ="预约人数",dataType = "java.lang.Integer",required = true)
    @NotNull(message = "cornershop_booking customerNum is empty")
    private Integer customerNum;
    @ApiModelProperty(value ="预定服务或内容",dataType = "java.lang.String",required = true)
    @NotEmpty(message = "cornershop_booking service is empty")
    private  String service;
    @ApiModelProperty(value ="预约人",dataType = "java.lang.String",required = true)
    @NotNull
    @NotEmpty(message = "cornershop_booking bookingPerson is empty")
    private String bookingPerson;
    @ApiModelProperty(value ="预约电话",dataType = "java.lang.String",required = true)
    @NotNull
    @NotEmpty(message = "cornershop_booking bookingPhone is empty")
    private String bookingPhone;


    @ApiModelProperty(hidden = true)
    private  String userId;
    @ApiModelProperty(hidden = true)
    private int bookingState = BookingEnum.WAITING.value(); //WAITING,REFUSE,AGREE


    public enum BookingEnum{
        WAITING(1),REFUSE(2),AGREE(3);

        private int code;

        BookingEnum(int code){
            this.code = code;
        }

        public int value(){
            return this.code;
        }
    }


	public String getShopId() {
		return shopId;
	}
	public void setShopId(String shopId) {
		this.shopId = shopId;
	}
	public Long getTime() {
		return time;
	}
	public void setTime(Long time) {
		this.time = time;
	}
	public Integer getCustomerNum() {
		return customerNum;
	}
	public void setCustomerNum(Integer customerNum) {
		this.customerNum = customerNum;
	}
	public String getService() {
		return service;
	}
	public void setService(String service) {
		this.service = service;
	}
	public String getBookingPerson() {
		return bookingPerson;
	}
	public void setBookingPerson(String bookingPerson) {
		this.bookingPerson = bookingPerson;
	}
	public String getBookingPhone() {
		return bookingPhone;
	}
	public void setBookingPhone(String bookingPhone) {
		this.bookingPhone = bookingPhone;
	}


	public String getUserId() {
		return userId;
	}


	public void setUserId(String userId) {
		this.userId = userId;
	}


	public int getBookingState() {
		return bookingState;
	}


	public void setBookingState(int bookingState) {
		this.bookingState = bookingState;
	}




}
